/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by:   焦质晔
 * @Last Modified time: 2019-06-20 15:45:00
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

// 维修类型 - 下拉框
export const getWxlxSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedataRepairtypes/findRoRepairType`, {
    params
  });

// 工时单价 - 下拉框
export const getGsdjSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedataRepairtypes/labourpriceItem`, {
    params
  });

// 保险公司 - 下拉框
export const getBxgsSelect = params =>
  axios.get(`/dms.web/vehicle/rest/vehicle/insProposal/insCompany`, {
    params
  });

// 指定技师 - 下拉框
export const getZdjsSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractSum/queryPreSum/Technician/Select`, {
    params
  });

// 服务工程师 - 下拉框
export const getFwgcsSelect = params =>
  axios.get(`/dms.web/customer/rest/precontractSum/queryPreSum/Service/Select`, {
    params
  });

// 品牌 - 下拉框
export const getPinpSelect = params =>
  axios.get(`/dms.web/customer/rest/customerManage/customerManager/brandsdicts`, {
    params
  });

// 车系 - 下拉框
export const getChexSelect = (id, params) =>
  axios.get(`/dms.web/manage/rest/basedata/brandsdictC/${id}/seriessdictC`, {
    params
  });

// 车型 - 下拉框
export const getCheModelSelect = (id, params) =>
  axios.get(`/dms.web/manage/rest/basedata/brandsdictC/LINCOLN/seriessdictC/${id}/modelsdictC`, {
    params
  });

// 项目车型组 - 下拉框
export const getXmcxzSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findProjectModelList`, {
    params
  });

// 工种 - 下拉框
export const getGongzSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/querytechnicianWorkType/item`, {
    params
  });

// 维修项目列表
export const getWxproductList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findRepairProjectList`, {
    params
  });

// 维修项目类型 - 下拉框
export const getWxtypeSelect = params =>
  axios.get(`/dms.web/part/rest/basedata/lendStuff/queryType`, {
    params
  });

// 维修备件列表
export const getWxpjList = (row, params) => {
  function toZero(flag) {
    return flag === null || flag === '' ? 0 : flag;
  }
  return axios.get(
    `${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findRepairProjectItem/${toZero(row.MODEL_LABOUR_CODE)}/${toZero(row.LABOUR_CODE)}/${toZero(row.DOWN_TAG)}/${toZero('3LN6L5EN5HR641574')}`,
    {
      params
    }
  );
};

// 主分类名称 - 下拉框
export const getZflmcSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findMainGroup`, {
    params
  });

// 维修项目是否存在 - 检查
export const isWxxmCheck = (id1, id2, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/queryModelLabourAllEntity/${id1}/${id2}`, {
    params
  });

// 项目维修列表
export const getWxxmList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findProjectModelList`, {
    params
  });

// 工单搜索列表
export const getGdssList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/searchRepairOrder`, {
    params
  });

// 收费类别 - 下拉框
export const getSflbSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryFee`, {
    params
  });

// 收费区分 - 下拉框
export const getSfqfSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/chargeDifferentiationList`, {
    params
  });

// 收费类别 - 列表
export const getSflbList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairEstimate/queryFees`, {
    params
  });

// 车辆搜索列表
export const getClssList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/license`, {
    params
  });

// 新增维修项目记录
export const addWxxmRecord = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/addLabour`, params);

// 查看在修工单
export const queryROByLicense = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}//order/repair/queryRepairOrderExists`, {
    params
  });

// 保修开始时间
export const getBxksTime = (vin, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/searchDate/${vin}`, {
    params
  });

// 查询工单明细
export const getGdmx = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/findOrderDetails`, {
    params
  });

// 预交车时间
export const getYjcTime = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/initEndTimeSupposed`, {
    params
  });

// 是否属于三包
export const getSbRange = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryIsThreeGuarantee`, {
    params
  });

// 客户接待 保存按钮
export const postSavelist = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/order/repair/btnSave`, params);

// 查询维修项目(选项卡)
export const getWXXM = (row, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryRoLabourByRoNO/${row}`, {
    params
  });

// 查询维修材料(选项卡)
export const getWXCL = (row, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryRoRepairPartByRoNO/${row}`, {
    params
  });

// 查询销售材料(选项卡)
export const getXSCL = (row, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/querySalesPartByRoNO/${row}`, {
    params
  });

// 查询附加项目(选项卡)
export const getFJXM = (row, params) => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryAddItem/${row}`, { params });
